{extend name="layout/detail" /}
{block name="content"}
<input id="ajax" value="1" type="hidden">
<div class="layui-tab td-tab-1 no-margin">
    <ul class="layui-tab-title">
        {volist name="config_tab_list" id="config_tab"}
        <a href="{:url($config_tab.type)}?tab_id={$config_tab.id}">
            <li class="{:map($config_tab.id,[$tab_id=>'layui-this'])}">{$config_tab.name}</li>
        </a>
        {/volist}
    </ul>
</div>
<div class="td-content-wrap no-margin p20">
    <div class="space-20"></div>
    <form id="form_data" class="layui-form" method="post" action="{:url('save')}">
        
        {volist name="field_list" id="field"}
        {:widget("Field/edit",[$field,$field.val])}        
        {/volist}
        <hr>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <a class="layui-btn" onclick="save();">保存</a>
                <a class="layui-btn layui-btn-primary" onclick="go_return_url();">取消</a>
            </div>
        </div>
    </form>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['common', 'element', 'uploader'], function () {
        set_return_url(null);

        var fn = {
            save: function () {
                send_form("form_data", "{:url('save_field')}", function (res) {
                    if (res.code) {
                        layer.msg(res.msg, {
                            time: 1200
                        }, function () {
                            location.reload(true);
                        });
                    } else {
                        layer.msg(res.msg);
                        return false;
                    }
                });
            }
        };

        win_exp(fn);
    });
</script>
{/block}